package com.javasm.mb_store_api_final.sys_control.usercontrol.sys_menu.controller;

import com.javasm.common.R;
import com.javasm.error.ExceptionEnum;
import com.javasm.error.JavasmException;
import com.javasm.mb_store_api_final.sys_control.usercontrol.sys_menu.entity.SysMenu;
import com.javasm.mb_store_api_final.sys_control.usercontrol.sys_menu.service.SysMenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @className:menucontroller
 * @author: zhl
 * @date:2024/8/122:39
 * @since : jdk11
 */
@RestController
@RequestMapping("/menu")
public class menucontroller {
    @Resource
    SysMenuService SysMenuService;
    @RequestMapping("/getMenuList")
    public R list(){
        List<SysMenu> menus = SysMenuService.listMenu();
        if (menus!=null){
            return R.ok(menus);
        }else{
            throw new JavasmException(ExceptionEnum.SelectError);
        }

    }
}
